package com.xindian.android.base.livepushsdk.util;

import android.content.Context;
import android.util.Log;

import com.duanqu.qupai.auth.AuthService;
import com.duanqu.qupai.auth.QupaiAuthListener;

/**
 * Created by liujianjiu on 16-9-27.
 * 推流工具类
 */

public class LivePushUtil {

    /**
     * 初始化趣拍并鉴权
     * @param context
     * @param qupaiKey 趣拍鉴权key
     * @param qupaiSecret 趣拍鉴权secret
     */
    public static void iniAndAuthPush(Context context,String qupaiKey, String qupaiSecret){
        for (String str : new String[]{"gnustl_shared", "qupai-media-thirdparty", "qupai-media-jni"}) {
            System.loadLibrary(str);
        }
        if(context == null || qupaiKey==null|| qupaiSecret==null){
            return;
        }
        AuthService service = AuthService.getInstance();
        service.setQupaiAuthListener(new QupaiAuthListener() {
            @Override
            public void onAuthError(int errorCode, String message) {
                Log.e("qupai", "errorCode=" + errorCode + ",message=" + message);
            }

            @Override
            public void onAuthComplte(int responseCode, String responseMessage) {

            }
        });
        service.startAuth(context, qupaiKey, qupaiSecret ,"tmp");

    }
}
